package com.UMLife.me.model;


public class LuckyListModel 
{
	String msg="";
	String respone="";
	String error="error";
	private Communication c=null;
	private String cellphone;
	
	
    /***
	 * @score
	 * 请求抽奖
	 * */
	
  public boolean Draw()
  {   //TODO
	  msg="7"+"|"+cellphone;
  	  c=new Communication();
	  Thread thread=new Thread(c);
	  c.Setmsg(msg);
      c.SetNb(1);
	 thread.start();
	 respone=c.Getrespone1();
	 if(respone.equals("1")) return true;
	  else return false;
  }
  
  
      /***
	 * @name
	 * @score
	 * 查看抽奖结果，请求成功返回奖品，否则返回error；
	 * */
  public String GetResult()
  {   //TODO
	  c=new Communication();
	  msg="8"+"|"+cellphone;
	  c=new Communication();
	  Thread thread=new Thread(c);
	  c.Setmsg(msg);
      c.SetNb(1);
	  thread.start();
	  try {
			thread.join();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	  this.respone=c.Getrespone1();
	  if(respone.equals("0"))  return error;
	  else return respone;
  }
  
  /***
   * 设置当前电话号码，上传给服务器
   * @cellphone
   * */
  public void setCellphone(String cellphone)
 {   //TODO
	 this.cellphone=cellphone;
 }
}
   

